//
//  DMPageAPIManager.h
//  DaMaoMall
//
//  Created by HXHL-wally on 16/8/1.
//  Copyright © 2016年 daMao-wally. All rights reserved.
//

#import "DMBaseAPIManager.h"

extern const NSInteger kPageSizeNotFound;
extern const NSInteger kPageIsLoading;

@protocol DMPageAPIManager<DMAPIManager>
@required
- (NSInteger)currentPageSize;// 从未加载过时，应返回kPageSizeNotFound
@end

// 子类化时必须实现DMPageAPIManager协议
@interface DMPageAPIManager : DMBaseAPIManager
@property (nonatomic, assign, readonly) NSInteger pageSize;
@property (nonatomic, assign, readonly) NSInteger currentPage;
@property (nonatomic, assign, readonly) BOOL hasNextPage;

// 重置currentPage
- (void)reset;
- (void)resetToPage:(NSInteger)page;

- (NSInteger)loadNextPage; // 如果正在加载则返回 kPageIsLoading，否则则返回requestId

- (instancetype)initWithPageSize:(NSInteger)pageSize;
- (instancetype)initWithPageSize:(NSInteger)pageSize startPage:(NSInteger)page NS_DESIGNATED_INITIALIZER;
@end
